package m.member.manage.model;

import m.common.model.FieldMeta;
import m.common.model.LinkTableMeta;
import m.common.model.TableMeta;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.system.cache.FlushCache;
import manage.model.AdminLogin;
import manage.model.OrgGroupView;
import manage.model.StatusModel;

import java.util.Date;

@TableMeta(name="t_member_info",description="会员信息表")
public class MemberInfo extends StatusModel implements FlushCache {

    @LinkTableMeta(name="level_oid",table= MemberLevel.class,description="会员级别")
    private MemberLevel level;

    @FieldMeta(name="real_name",type= FieldType.STRING,length=20,description="姓名")
    private String realName;
    @FieldMeta(name="phone_num",type= FieldType.STRING,length=20,description="手机号")
    private String phoneNum;
    @FieldMeta(name="birthday",type=FieldType.DATE,description="生日")
    private Date birthday;
    @FieldMeta(name = "balance",type = FieldType.DOUBLE,defaultValue = "0",description = "余额")
    private Double balance;
    @FieldMeta(name = "freeze",type = FieldType.DOUBLE,defaultValue = "0",description = "冻结余额")
    private Double freeze;
    @FieldMeta(name = "real_money",type = FieldType.DOUBLE,defaultValue = "0",description = "实际金额")
    private Double realMoney;
    @FieldMeta(name = "give_money",type = FieldType.DOUBLE,defaultValue = "0",description = "赠送金额")
    private Double giveMoney;

    @FieldMeta(name = "point",type = FieldType.INT,defaultValue = "0",description = "积分")
    private Integer point;
    @FieldMeta(name = "use_money",type = FieldType.DOUBLE,defaultValue = "0",description = "已用金额")
    private Double useMoney;
    @FieldMeta(name = "order_num",type = FieldType.INT,defaultValue = "0",description = "订单数")
    private Integer orderNum;

    @FieldMeta(name="remark",type= FieldType.STRING,length=500,description="备注")
    private String remark;

    @FieldMeta(name="input_date",type=FieldType.DATE,defaultValue = "CURRENT_TIMESTAMP",description="录入时间")
    private Date inputDate;
    @LinkTableMeta(name="input_admin_oid",table= AdminLogin.class,description="录入人")
    private AdminLogin inputAdmin;
    @LinkTableMeta(name="input_dept_oid",table= OrgGroupView.class,description="录入部门")
    private OrgGroupView inputDept;

    public Double getFreeze() {
        return freeze;
    }

    public void setFreeze(Double freeze) {
        this.freeze = freeze;
    }

    public AdminLogin getInputAdmin() {
        return inputAdmin;
    }

    public void setInputAdmin(AdminLogin inputAdmin) {
        this.inputAdmin = inputAdmin;
    }

    public OrgGroupView getInputDept() {
        return inputDept;
    }

    public void setInputDept(OrgGroupView inputDept) {
        this.inputDept = inputDept;
    }

    public Date getInputDate() {
        return inputDate;
    }

    public void setInputDate(Date inputDate) {
        this.inputDate = inputDate;
    }

    public MemberLevel getLevel() {
        return level;
    }

    public void setLevel(MemberLevel level) {
        this.level = level;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Double getBalance() {
        return balance;
    }

    public void setBalance(Double balance) {
        this.balance = balance;
    }

    public Double getRealMoney() {
        return realMoney;
    }

    public void setRealMoney(Double realMoney) {
        this.realMoney = realMoney;
    }

    public Double getGiveMoney() {
        return giveMoney;
    }

    public void setGiveMoney(Double giveMoney) {
        this.giveMoney = giveMoney;
    }

    public Integer getPoint() {
        return point;
    }

    public void setPoint(Integer point) {
        this.point = point;
    }

    public Double getUseMoney() {
        return useMoney;
    }

    public void setUseMoney(Double useMoney) {
        this.useMoney = useMoney;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public MemberInfo getCacheModel(String s) throws Exception {
        return ModelQueryList.getModel(MemberInfo.class,s,"*","level.*");
    }
}
